﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        xmlns:cal="clr-namespace:Microsoft.Practices.Composite.Presentation.Regions;assembly=Microsoft.Practices.Composite.Presentation"
        xmlns:Controls="clr-namespace:Blacklight.Controls;assembly=Blacklight.Controls"
        xmlns:Infrastructure="clr-namespace:pushbomb.composite.core.Infrastructure;assembly=pushbomb.composite.core"
        x:Class="HitTester.Observable.MainPage">
    <UserControl.Resources>
        <Style x:Key="DragDockPanelStyleCustom" TargetType="Controls:DragDockPanel">
            <Setter Property="Background" Value="#ff000000" />
            <Setter Property="BorderBrush" Value="#ff333333" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Controls:DragDockPanel">
                        <Grid>
                            <Controls:OuterGlowBorder Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,3,3"
                                    OuterGlowOpacity="0.4" OuterGlowSize="15">
                                <Controls:InnerGlowBorder Background="Transparent" BorderThickness="0" Padding="2"
                                        Margin="0" ClipContent="True" CornerRadius="3,3,3,3" InnerGlowColor="#11ffffff"
                                        InnerGlowOpacity="1" InnerGlowSize="15,15,0,0">
                                    <Grid Background="{StaticResource DefaultBackground}">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                        <ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}"
                                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                                        <Border Margin="-2" Background="#7f000000" Padding="3"
                                                BorderBrush="{StaticResource DefaultBackground}" BorderThickness="2">
                                            <Grid>
                                                <Border x:Name="GripBarElement" Cursor="Hand" Margin="0,0,32,0"
                                                        MinHeight="30" VerticalAlignment="Top"
                                                        IsHitTestVisible="{TemplateBinding DraggingEnabled}"
                                                        Background="#00ffffff" CornerRadius="3,3,0,0">
                                                    <Grid>
                                                        <Rectangle Opacity="0.5"
                                                                Fill="{StaticResource DragDropHeaderStripes}" />
                                                        <ContentPresenter Content="{TemplateBinding Header}"
                                                                ContentTemplate="{TemplateBinding HeaderTemplate}" />
                                                    </Grid>
                                                </Border>
                                                <ToggleButton x:Name="MaximizeToggleButton" Cursor="Hand" Height="20"
                                                        HorizontalAlignment="Right" Margin="0,5,5,0"
                                                        VerticalAlignment="Top" Width="20">
                                                    <ToggleButton.Template>
                                                        <ControlTemplate TargetType="ToggleButton">
                                                            <Border Background="#7F000000" CornerRadius="2,2,2,2">
                                                                <VisualStateManager.VisualStateGroups>
                                                                    <VisualStateGroup x:Name="FocusStates">
                                                                        <VisualState x:Name="Focused" />
                                                                        <VisualState x:Name="Unfocused" />
                                                                    </VisualStateGroup>
                                                                    <VisualStateGroup x:Name="CommonStates">
                                                                        <VisualState x:Name="Disabled" />
                                                                        <VisualState x:Name="Normal" />
                                                                        <VisualState x:Name="MouseOver">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Storyboard.TargetName="rectangle"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00"
                                                                                            Value="0.6" />
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00.2000000"
                                                                                            Value="0.3" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                        <VisualState x:Name="Pressed">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="rectangle"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00"
                                                                                            Value="0.15" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                    </VisualStateGroup>
                                                                    <VisualStateGroup x:Name="CheckStates">
                                                                        <VisualState x:Name="Checked">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="checkedArrow"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00" Value="1" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="uncheckedArrow"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00" Value="0" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                        <VisualState x:Name="Unchecked">
                                                                            <Storyboard />
                                                                        </VisualState>
                                                                        <VisualState x:Name="Indeterminate" />
                                                                    </VisualStateGroup>
                                                                </VisualStateManager.VisualStateGroups>
                                                                <Grid Height="Auto" Width="Auto">
                                                                    <Border Height="16" Margin="0,0,0,0" Width="16"
                                                                            BorderBrush="#FFFFFFFF"
                                                                            BorderThickness="1,1,1,1"
                                                                            CornerRadius="1,1,1,1">
                                                                        <Grid>
                                                                            <Path x:Name="uncheckedArrow" Stretch="Fill"
                                                                                    Stroke="#FFFFFFFF"
                                                                                    HorizontalAlignment="Right"
                                                                                    Margin="0,1.24500000476837,1.70700001716614,5.375"
                                                                                    VerticalAlignment="Stretch"
                                                                                    Width="6.752"
                                                                                    Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001" />
                                                                            <Path x:Name="checkedArrow" Stretch="Fill"
                                                                                    Stroke="#FFFFFFFF"
                                                                                    HorizontalAlignment="Stretch"
                                                                                    Margin="1.45899999141693,5.74200010299683,5.78900003433228,0.878000020980835"
                                                                                    VerticalAlignment="Stretch"
                                                                                    Opacity="0"
                                                                                    RenderTransformOrigin="0.5,0.5"
                                                                                    Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001">
                                                                                <Path.RenderTransform>
                                                                                    <TransformGroup>
                                                                                        <ScaleTransform />
                                                                                        <SkewTransform />
                                                                                        <RotateTransform Angle="180" />
                                                                                        <TranslateTransform />
                                                                                    </TransformGroup>
                                                                                </Path.RenderTransform>
                                                                            </Path>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle x:Name="rectangle" Fill="#FFFFFFFF"
                                                                            RadiusX="2" RadiusY="2" Margin="1,1,1,1"
                                                                            Opacity="0" />
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </ToggleButton.Template>
                                                </ToggleButton>
                                            </Grid>
                                        </Border>
                                    </Grid>
                                </Controls:InnerGlowBorder>
                            </Controls:OuterGlowBorder>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Controls:DropShadowTextBlock FontFamily="Verdana" FontSize="14" Foreground="#ffffffff"
                                Margin="5" VerticalAlignment="Center" DropShadowAngle="45" DropShadowDistance="3"
                                Text="{Binding}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="DragDockPanelStyle1" TargetType="Controls:DragDockPanel">
            <Setter Property="Background" Value="#ff000000" />
            <Setter Property="BorderBrush" Value="#ff333333" />
            <Setter Property="BorderThickness" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Controls:DragDockPanel">
                        <Grid>
                            <Controls:OuterGlowBorder Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3,3,3,3"
                                    OuterGlowOpacity="0.4" OuterGlowSize="15">
                                <Controls:InnerGlowBorder Background="Transparent" BorderThickness="0" Padding="2"
                                        Margin="0" ClipContent="True" CornerRadius="3,3,3,3" InnerGlowColor="#11ffffff"
                                        InnerGlowOpacity="1" InnerGlowSize="15,15,0,0">
                                    <Grid Background="{StaticResource DefaultBackground}">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto" />
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                        <ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}"
                                                ContentTemplate="{TemplateBinding ContentTemplate}" />
                                        <Border Margin="-2" Background="#7f000000" Padding="3"
                                                BorderBrush="{TemplateBinding Foreground}">
                                            <Grid>
                                                <Border x:Name="GripBarElement" Cursor="Hand" Margin="0,0,32,0"
                                                        MinHeight="30" VerticalAlignment="Top"
                                                        IsHitTestVisible="{TemplateBinding DraggingEnabled}"
                                                        Background="#00ffffff" CornerRadius="3,3,0,0">
                                                    <Grid>
                                                        <Rectangle Opacity="0.5">
                                                            <Rectangle.Fill>
                                                                <LinearGradientBrush
                                                                        EndPoint="6.58300018310547,6.08300018310547"
                                                                        StartPoint="2.31500005722046,1.81500005722046"
                                                                        MappingMode="Absolute" SpreadMethod="Repeat">
                                                                    <GradientStop Color="#FFAFAFAF" Offset="0" />
                                                                    <GradientStop Color="#00FFFFFF" Offset="1" />
                                                                    <GradientStop Color="#00FFFFFF" Offset="0.339" />
                                                                </LinearGradientBrush>
                                                            </Rectangle.Fill>
                                                        </Rectangle>
                                                        <ContentPresenter Content="{TemplateBinding Header}"
                                                                ContentTemplate="{TemplateBinding HeaderTemplate}" />
                                                    </Grid>
                                                </Border>
                                                <ToggleButton x:Name="MaximizeToggleButton" Cursor="Hand" Height="20"
                                                        HorizontalAlignment="Right" Margin="0,5,5,0"
                                                        VerticalAlignment="Top" Width="20">
                                                    <ToggleButton.Template>
                                                        <ControlTemplate TargetType="ToggleButton">
                                                            <Border Background="#7F000000" CornerRadius="2,2,2,2">
                                                                <VisualStateManager.VisualStateGroups>
                                                                    <VisualStateGroup x:Name="FocusStates">
                                                                        <VisualState x:Name="Focused" />
                                                                        <VisualState x:Name="Unfocused" />
                                                                    </VisualStateGroup>
                                                                    <VisualStateGroup x:Name="CommonStates">
                                                                        <VisualState x:Name="Disabled" />
                                                                        <VisualState x:Name="Normal" />
                                                                        <VisualState x:Name="MouseOver">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Storyboard.TargetName="rectangle"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00"
                                                                                            Value="0.6" />
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00.2000000"
                                                                                            Value="0.3" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                        <VisualState x:Name="Pressed">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="rectangle"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00"
                                                                                            Value="0.15" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                    </VisualStateGroup>
                                                                    <VisualStateGroup x:Name="CheckStates">
                                                                        <VisualState x:Name="Checked">
                                                                            <Storyboard>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="checkedArrow"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00" Value="1" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                                <DoubleAnimationUsingKeyFrames
                                                                                        BeginTime="00:00:00"
                                                                                        Duration="00:00:00.0010000"
                                                                                        Storyboard.TargetName="uncheckedArrow"
                                                                                        Storyboard.TargetProperty="(UIElement.Opacity)">
                                                                                    <SplineDoubleKeyFrame
                                                                                            KeyTime="00:00:00" Value="0" />
                                                                                </DoubleAnimationUsingKeyFrames>
                                                                            </Storyboard>
                                                                        </VisualState>
                                                                        <VisualState x:Name="Unchecked">
                                                                            <Storyboard />
                                                                        </VisualState>
                                                                        <VisualState x:Name="Indeterminate" />
                                                                    </VisualStateGroup>
                                                                </VisualStateManager.VisualStateGroups>
                                                                <Grid Height="Auto" Width="Auto">
                                                                    <Border Height="16" Margin="0,0,0,0" Width="16"
                                                                            BorderBrush="#FFFFFFFF"
                                                                            BorderThickness="1,1,1,1"
                                                                            CornerRadius="1,1,1,1">
                                                                        <Grid>
                                                                            <Path x:Name="uncheckedArrow" Stretch="Fill"
                                                                                    Stroke="#FFFFFFFF"
                                                                                    HorizontalAlignment="Right"
                                                                                    Margin="0,1.24500000476837,1.70700001716614,5.375"
                                                                                    VerticalAlignment="Stretch"
                                                                                    Width="6.752"
                                                                                    Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001" />
                                                                            <Path x:Name="checkedArrow" Stretch="Fill"
                                                                                    Stroke="#FFFFFFFF"
                                                                                    HorizontalAlignment="Stretch"
                                                                                    Margin="1.45899999141693,5.74200010299683,5.78900003433228,0.878000020980835"
                                                                                    VerticalAlignment="Stretch"
                                                                                    Opacity="0"
                                                                                    RenderTransformOrigin="0.5,0.5"
                                                                                    Data="M0.5,1.005 L6.2509999,1.005 M6.25,6.8800006 L6.25,0.5 M6.2520003,1.0880001 L0.50000024,6.8800001">
                                                                                <Path.RenderTransform>
                                                                                    <TransformGroup>
                                                                                        <ScaleTransform />
                                                                                        <SkewTransform />
                                                                                        <RotateTransform Angle="180" />
                                                                                        <TranslateTransform />
                                                                                    </TransformGroup>
                                                                                </Path.RenderTransform>
                                                                            </Path>
                                                                        </Grid>
                                                                    </Border>
                                                                    <Rectangle x:Name="rectangle" Fill="#FFFFFFFF"
                                                                            RadiusX="2" RadiusY="2" Margin="1,1,1,1"
                                                                            Opacity="0" />
                                                                </Grid>
                                                            </Border>
                                                        </ControlTemplate>
                                                    </ToggleButton.Template>
                                                </ToggleButton>
                                            </Grid>
                                        </Border>
                                    </Grid>
                                </Controls:InnerGlowBorder>
                            </Controls:OuterGlowBorder>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Controls:DropShadowTextBlock FontFamily="Verdana" FontSize="14" Foreground="#ffffffff"
                                Margin="5" VerticalAlignment="Center" DropShadowAngle="45" DropShadowDistance="3"
                                Text="{Binding}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate x:Key="DragDockPanelTemplate">
            <Controls:DragDockPanel DraggingEnabled="True" FontFamily="{StaticResource defaultFont}"
                    Background="{StaticResource DefaultBackground}" FontSize="18.667"
                    Style="{StaticResource DragDockPanelStyle1}" TabNavigation="Cycle">
                <ContentPresenter />
            </Controls:DragDockPanel>
        </DataTemplate>

        <Infrastructure:LogPublisher x:Key="logHost" />
    </UserControl.Resources>

    <Grid Background="{StaticResource DragDropHeaderStripes}">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <ContentControl cal:RegionManager.RegionName="SelectionRegion"
                Background="{StaticResource DragDropHeaderStripes}" />

        <ListBox Grid.Column="1" HorizontalAlignment="Right"   VerticalAlignment="Top" ItemsSource="{Binding Path=Log, Source={StaticResource logHost}}" />

        <Controls:DragDockPanelHost Grid.ColumnSpan="2" Grid.Row="1" BorderBrush="{StaticResource ForegroundColor}"
                Background="{StaticResource DefaultBackground}" MaxColumns="2" MaxRows="100" x:Name="mainDragDrop"
                MinimizedPosition="Left" MinimizedColumnWidth="200" cal:RegionManager.RegionName="MainRegion"
                RenderTransformOrigin="0.5,0.5" DefaultPanelStyle="{StaticResource DragDockPanelStyleCustom}"
                ItemTemplate="{StaticResource DragDockPanelTemplate}" FontFamily="{StaticResource defaultFont}"
                Margin="0,-10,0,0">

 
        </Controls:DragDockPanelHost>


    </Grid>
                                                       
</UserControl>
